<%@page import="java.util.Iterator"%>
<%@page import="java.util.Collection"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="common.jsp"%>
<jsp:useBean id="cart" scope="session" class="cn.jhc.bean.CartBean"></jsp:useBean>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>吉他小店</title>
</head>
<body>
<jsp:include page="./header.jsp"></jsp:include>

	<%
		request.setCharacterEncoding("UTF-8");
		String Class = request.getParameter("class");
		String address = request.getParameter("address");
		String contact = request.getParameter("contact");
		String phone = request.getParameter("phone");
		String action = request.getParameter("action");
		UserBean user = (UserBean) session.getAttribute("user");
		if (null == user) {
			String getb = (String) request.getParameter("getb");
			RequestDispatcher dispatcher = request
					.getRequestDispatcher("/login.jsp");
			dispatcher.forward(request, response);
			return;
		}
		

		if (action != null && action.equals("确定") && Class != null
				&& address != null && contact != null && phone != null
				&& !Class.equals("") && !address.equals("")
				&& !contact.equals("") && !phone.equals("")) {
	%>
	<jsp:include page="addlist.jsp" flush="false" />
	<%
		shopdb.buyShop(cart);
			cart.clear();
			out.print("订单提交成功!");
	%>
	<a href="index.jsp">返回主页</a>
	<%
		} else {
			out.println("所有信息必填");
	%>
	<%if(action != null&&action.equals("确定"))
		{
		out.println("<font color=\"red\" size=\"4\">");
		out.println("请填满所有信息！<p>");
		out.println("</font>");
		}%>
	<form name="thesm" action="settlement.jsp" method="post">
		<table border=1>
			<tr>
				<td>学院班级</td>
				<td><input type="text" name="class"></td>
			</tr>
			<tr>
				<td>联系地址</td>
				<td><input type="text" name="address"></td>
			</tr>
			<tr>
				<td>联系人</td>
				<td><input type="text" name="contact"></td>
			</tr>
			<tr>
				<td>联系电话</td>
				<td><input type="text" name="phone"></td>
			</tr>
		</table>
		<input type="submit" name="action" value="确定">

	</form>
	<%
		}
	%>

</body>
</html>
